def js2(char_id):
    jsCode1 = '''
                <script>
                    chart_''' + char_id + '''.on('click', function (param){
                        var selected = param.name;
                            if (selected) {
                                switch(selected){
                                    case '广东省':location.href = "./广东地图.html";break;
                                    case '北京市':location.href = "./北京地图.html";break;
                                    case '上海市':location.href = "./上海地图.html";break;
                                    case '天津市':location.href = "./天津地图.html";break;
                                    case '四川省':location.href = "./四川地图.html";break;
                                    case '安徽省':location.href = "./安徽地图.html";break;
                                    case '山东省':location.href = "./山东地图.html";break;
                                    case '江苏省':location.href = "./江苏地图.html";break;
                                    case '江西省':location.href = "./江西地图.html";break;
                                    case '河北省':location.href = "./河北地图.html";break;
                                    case '浙江省':location.href = "./浙江地图.html";break;
                                    case '海南省':location.href = "./海南地图.html";break;
                                    case '湖北省':location.href = "./湖北地图.html";break;
                                    case '湖南省':location.href = "./湖南地图.html";break;
                                    case '福建省':location.href = "./福建地图.html";break;
                                    case '甘肃省':location.href = "./甘肃地图.html";break;
                                    case '广西壮族自治区':location.href = "./广西地图.html";break;
                                    case '贵州省':location.href = "./贵州地图.html";break;
                                    case '河南省':location.href = "./河南地图.html";break;
                                    case '黑龙江省':location.href = "./黑龙江地图.html";break;
                                    case '内蒙古自治区':location.href = "./内蒙古地图.html";break;
                                    case '吉林省':location.href = "./吉林地图.html";break;
                                    case '辽宁省':location.href = "./辽宁地图.html";break;
                                    case '宁夏回族自治区':location.href = "./宁夏地图.html";break;
                                    case '青海省':location.href = "./青海地图.html";break;
                                    case '山西省':location.href = "./山西地图.html";break;
                                    case '陕西省':location.href = "./陕西地图.html";break;
                                    case '台湾省':location.href = "./台湾地图.html";break;
                                    case '西藏自治区':location.href = "./西藏地图.html";break;
                                    case '新疆维吾尔自治区':location.href = "./新疆地图.html";break;
                                    case '云南省':location.href = "./云南地图.html";break;
                                    case '重庆市':location.href = "./重庆地图.html";break;
                                    case '香港特别行政区':location.href = "./香港地图.html";
                                    case '澳门特别行政区':location.href = "./澳门地图.html";
                                    default:
                                        break;
                                }
                            }
                        });
                </script>    
                '''
    return jsCode1


with open('D:/Courses/SmallThree/scrapy_spider/combine.html', 'a', encoding="utf-8") as f:
    f.write(js2(char_id='d6c02a039ae847bab928168a17973b94'))
